//
//  ContentModel.swift
//  LoadBSBJ
//
//  Created by eport_user1 on 2018/1/8.
//  Copyright © 2018年 eport_user1. All rights reserved.
//

import UIKit

class ContentModel: NSObject {

    /// id
    var ID: String = ""
    /// 名称
    var name: String = ""
    /// 头像的URL
    var profile_image: String = ""
    /// 发帖时间
    var create_time: String = ""
    /// 文字内容
    var text: String = ""
    /// 顶的数量
    var ding: Int = 0
    /// 踩的数量
    var cai: Int = 0
    /// 转发的数量
    var repost: Int = 0
    /// 评论的数量
    var comment: Int = 0
    /// 图片的宽度
    var width: CGFloat = 0
    /// 图片的高度
    var height: CGFloat = 0
    /// 小图
    var small_image: String = ""
    /// 中图
    var middle_image: String = ""
    /// 大图
    var large_image: String = ""
    /// 播放数量
    var playcount: Int = 0
    /// 播放时长
    var voicetime: Int = 0
    /// 视频时长
    var videotime: Int = 0
    /// 类型
    var type: Int = 0
    
    
    var isBigPicture: Bool = false
    
    
    init(dict:[String : Any]){
        
        ID = dict["id"] as? String ?? ""
        text = dict ["text"] as? String ?? ""
        name = dict["name"] as? String ?? ""
        profile_image = dict["profile_image"] as? String ?? ""
        create_time = dict["create_time"] as? String ?? ""
        
        //服务返回的事字符串类型 所以这边通过如下方法装换成int
        ding = Int((dict["ding"] as? NSString ?? "0").intValue)
        cai =  Int((dict["cai"] as? NSString ?? "0").intValue)
        repost = dict["repost"] as? Int ?? 0
        comment = Int((dict["comment"] as? NSString ?? "0").intValue)
        width = CGFloat((dict["width"] as? NSString ?? "0").floatValue)
        height = CGFloat((dict["height"] as? NSString ?? "0").floatValue)
        
        playcount =  Int((dict["playcount"] as? NSString ?? "0").intValue)
        videotime =  Int((dict["videotime"] as? NSString ?? "0").intValue)
        type = Int((dict["type"] as? NSString ?? "0").intValue)
        voicetime = Int((dict["voicetime"] as? NSString ?? "0").intValue)
        
        small_image = dict["image0"] as? String ?? ""
        middle_image = dict["image2"] as? String ?? ""
        large_image = dict["image1"] as? String ?? ""
       
    }
    
    
}
